//
//  MineViewController.m
//  LZMPro
//
//  Created by dllo on 15/11/4.
//  Copyright © 2015年 LZS. All rights reserved.
//

#import "MineViewController.h"
#import "UIImage+original.h"
@interface MineViewController ()

@end

@implementation MineViewController



- (void)viewDidLoad {
    [super viewDidLoad];
    
    
   

    
    
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]initWithImage:[UIImage  getoraiginalImageWithName:@"pre_like"] style:(UIBarButtonItemStylePlain) target:self action:@selector(nightAndDay)];
    
     NSString *str = [[NSUserDefaults standardUserDefaults] objectForKey:@"Night"];
    if ([str isEqualToString:@"no"]) {
        
        self.navigationItem.rightBarButtonItem.image = [UIImage getoraiginalImageWithName:@"noco"];
        
    }
     
    
}

-(void)nightAndDay
{
    NSUserDefaults *user = [NSUserDefaults standardUserDefaults];
    
    NSString *str = [user objectForKey:@"Night"];
    
   
    
    
    if ([str isEqualToString:@"yes"]) {
        
        str = @"no";
        self.navigationItem.rightBarButtonItem.image = [UIImage getoraiginalImageWithName:@"noco"];
    }
    
    else
    {
        
        str = @"yes";
        self.navigationItem.rightBarButtonItem.image = [UIImage getoraiginalImageWithName:@"pre_like"];
 
    }
    
    
    //通知当前是神马情况
     [[NSNotificationCenter  defaultCenter] postNotificationName:@"ChangeStyle" object:str];
    
    
    [user  setObject:str forKey:@"Night"];
    
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    
}


@end
